#!/bin/bash

echo "聊天系统启动脚本"
echo "================="

echo ""
echo "1. 启动后端服务..."
cd backend
gnome-terminal --title="Chat System Backend" -- bash -c "mvn spring-boot:run; exec bash" &
cd ..

echo ""
echo "2. 等待后端启动完成..."
sleep 10

echo ""
echo "3. 启动前端服务..."
cd frontend
gnome-terminal --title="Chat System Frontend" -- bash -c "npm install && npm run dev; exec bash" &
cd ..

echo ""
echo "启动完成！"
echo "后端地址: http://localhost:8080/api"
echo "前端地址: http://localhost:3000"
echo ""
echo "请确保已安装以下依赖："
echo "- Java 11+"
echo "- Maven 3.6+"
echo "- Node.js 16+"
echo "- MySQL 8.0+"
echo ""
read -p "按任意键继续..." 